package test;

import cn.swpu.service.TestService;
import org.hibernate.SessionFactory;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Created by 11616 on 2016/7/7.
 */
public class testsessionFactory {
    ApplicationContext applicationContext = new ClassPathXmlApplicationContext("spring-config.xml");
    @Test
    public  void testsessionFactory() throws  Exception{

        SessionFactory  sessionFactory = (SessionFactory) applicationContext.getBean("sessionFactory");
        System.out.println("--------");
        System.out.println(sessionFactory);
    }
    @Test
    public void testTransaction() throws Exception{
        TestService testService = (TestService) applicationContext.getBean("testService");
        testService.saveDepartment();
        System.out.println("---------");
        System.out.println(testService);
    }


}
